CREATE PROCEDURE InsertarCategoriaProducto
	@CategoryName NVarChar(15),
	@ProductName NVarChar(40)
AS
BEGIN
	
	SET XACT_ABORT ON;
	
	BEGIN TRANSACTION

	-- 1. INSERTAR CATEGORIA
	INSERT INTO Categories (CategoryName) VALUES (@CategoryName);
	DECLARE @CategoryID Int = @@IDENTITY;

	INSERT INTO Products (ProductName, CategoryID) 
		VALUES (@ProductName, @CategoryID);
		
	COMMIT;
END
GO
